package cn.com.xjnt.vas.ordering.domain.entity;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * The persistent class for the ordering_user database table.
 * 
 */
@Entity
@Table(name = "ordering_user")
@NamedQuery(name = "User.findAll", query = "SELECT u FROM User u")
public class User extends com.frameworks.core.entity.IdEntity {
    private static final long serialVersionUID = 1L;

    private String cardno;

    private String mobile;


    // bi-directional many-to-one association to FoodOrder
    @OneToMany(mappedBy = "user")
    private List<FoodOrder> foodOrders;

    // bi-directional many-to-one association to Doctor
    @OneToOne(mappedBy = "user", targetEntity = EmployeeInfo.class)
    private EmployeeInfo employeeInfo;

    // bi-directional many-to-one association to Family
    @OneToOne(mappedBy = "user", targetEntity = UserInfo.class)
    private UserInfo userInfo;
    
    public User() {
    }

    public String getCardno() {
        return this.cardno;
    }

    public void setCardno(String cardno) {
        this.cardno = cardno;
    }

    public String getMobile() {
        return this.mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }


    public List<FoodOrder> getFoodOrders() {
        return this.foodOrders;
    }

    public void setFoodOrders(List<FoodOrder> foodOrders) {
        this.foodOrders = foodOrders;
    }

    public FoodOrder addFoodOrder(FoodOrder foodOrder) {
        getFoodOrders().add(foodOrder);
        foodOrder.setUser(this);

        return foodOrder;
    }

    public FoodOrder removeFoodOrder(FoodOrder foodOrder) {
        getFoodOrders().remove(foodOrder);
        foodOrder.setUser(null);

        return foodOrder;
    }

    public EmployeeInfo getEmployeeInfo() {
        return employeeInfo;
    }

    public void setEmployeeInfo(EmployeeInfo employeeInfo) {
        this.employeeInfo = employeeInfo;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }

    public void setUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
    }
}